package com.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.UserMapper;
import com.model.User;
import com.service.IUserService;

@Service("userService")
public class UserServiceImpl implements IUserService {
	@Resource
	private UserMapper userMapper;

	public User getUserById(Integer id) {
		return userMapper.selectByPrimaryKey(id);
	}

	public int saveUser(User u) {
		int i = userMapper.insertSelective(u);
		return i;
	}

	public List<User> findAll(Map<Object, Object> map) {
		List<User> list = userMapper.selectAllUsers(map);
		return list;
	}

	public int updateUser(User u) {
		int i = userMapper.updateByPrimaryKeySelective(u);
		return i;
	}

	public int countUsers(Map<Object, Object> map) {
		return userMapper.countUsers(map);
	}

	public List<User> findUserByNo(String no) {
		return userMapper.findUserByNo(no);
	}

	public int countUserByNo(String no) {
		int i = userMapper.countUserByNo(no);
		return i;
	}
	
	
	
	

}
